exports.install = function (Vue, options) {
	// 可滚动表格
	Vue.prototype.setHeight = function(h){
        let wHeight = window.innerHeight;
        let hHeight = $('.header').height();
        let fHeight = $('#footer').outerHeight();
        let cutHeight1 = wHeight - hHeight - fHeight - h;
        let cutHeight2 = cutHeight1 + 17;
        let rWidth = $('#right_div').width();
        let rtWidth = $('#right_table2').width();
		$('#left_div2').height(cutHeight1);
        if((rtWidth - rWidth) > 0){ //table出现横向滚动条
        	$('#right_div2').height(cutHeight2);
        }else{
        	$('#right_div2').height(cutHeight1);
        }
    }
    Vue.prototype.getTableScroll = function(){
        var right_div2 = document.getElementById("right_div2");
        right_div2.onscroll = function() {
            var right_div2_top = this.scrollTop;
            var right_div2_left = this.scrollLeft;
            $('#left_div2').scrollTop(right_div2_top);
            $('#right_div1').scrollLeft(right_div2_left);
        }
        // //设置右边div宽度
        let rWidth = $('.table_content').width() - $('#left_div').width();
        $('#right_div, #right_div1').width(rWidth - 17);
    }
    Vue.prototype.isResize = function(key){
	    const that = this
	    window.onresize = function(){
	        window.screenWidth = document.body.clientWidth;
	        that.screenWidth = window.screenWidth;
	        that.getTableScroll();
	        that.setHeight();
	    };
	},

    Vue.prototype.importSuccess = function(res){
        if(res.resopnse.code){
            this.$Notice.success({
                title: '提示',
                desc: '导入成功'
            });
        }
    },
    // Vue.prototype.nationData = [{key:'壮族',val:'壮族'},{key:'汉族',val:'汉族'},{key:'藏族',val:'藏族'},{key:'裕固族',val:'裕固族'},{key:'彝族',val:'彝族'},{key:'瑶族',val:'瑶族'},{key:'锡伯族',val:'锡伯族'},{key:'乌孜别克族',val:'乌孜别克族'},{key:'维吾尔族',val:'维吾尔族'},{key:'佤族',val:'佤族'},{key:'土家族',val:'土家族'},{key:'土族',val:'土族'},{key:'塔塔尔族',val:'塔塔尔族'},{key:'塔吉克族',val:'塔吉克族'},{key:'水族',val:'水族'},{key:'畲族',val:'畲族'},{key:'撒拉族',val:'撒拉族'},{key:'羌族',val:'羌族'},{key:'普米族',val:'普米族'},{key:'怒族',val:'怒族'},{key:'纳西族',val:'纳西族'},{key:'仫佬族',val:'仫佬族'},{key:'苗族',val:'苗族'},{key:'蒙古族',val:'蒙古族'},{key:'门巴族',val:'门巴族'},{key:'毛南族',val:'毛南族'},{key:'满族',val:'满族'},{key:'珞巴族',val:'珞巴族'},{key:'僳僳族',val:'僳僳族'},{key:'黎族',val:'黎族'},{key:'拉祜族',val:'拉祜族'},{key:'柯尔克孜族',val:'柯尔克孜族'},{key:'景颇族',val:'景颇族'},{key:'京族',val:'京族'},{key:'基诺族',val:'基诺族'},{key:'回族',val:'回族'},{key:'赫哲族',val:'赫哲族'},{key:'哈萨克族',val:'哈萨克族'},{key:'哈尼族',val:'哈尼族'},{key:'仡佬族',val:'仡佬族'},{key:'高山族',val:'高山族'},{key:'鄂温克族',val:'鄂温克族'},{key:'俄罗斯族',val:'俄罗斯族'},{key:'鄂伦春族',val:'鄂伦春族'},{key:'独龙族',val:'独龙族'},{key:'东乡族',val:'东乡族'},{key:'侗族',val:'侗族'},{key:'德昂族',val:'德昂族'},{key:'傣族',val:'傣族'},{key:'达斡尔族',val:'达斡尔族'},{key:'朝鲜族',val:'朝鲜族'},{key:'布依族',val:'布依族'},{key:'布朗族',val:'布朗族'},{key:'保安族',val:'保安族'},{key:'白族',val:'白族'},{key:'阿昌族',val:'阿昌族'}],

    Vue.prototype.nationData = ['汉族', '壮族', '藏族','裕固族', '彝族', '瑶族', '锡伯族', '乌孜别克族', '维吾尔族', '佤族',
    '土家族', '土族', '塔塔尔族', '塔吉克族', '水族', '畲族', '撒拉族', '羌族', '普米族', '怒族', '纳西族仫佬族',
    '苗族', '蒙古族', '门巴族', '毛南族', '满族', '珞巴族', '僳僳族', '黎族', '拉祜族', '柯尔克孜族', '景颇族',
    '京族', '基诺族', '回族', '赫哲族', '哈萨克族', '哈尼族', '仡佬族', '高山族', '鄂温克族', '俄罗斯族', '鄂伦春族',
    '独龙族', '东乡族', '侗族', '德昂族', '傣族', '达斡尔族', '朝鲜族', '布依族', '布朗族', '保安族', '白族', '阿昌族'],

    // PS：全局指令
    Vue.directive('clickoutside', {
        // 初始化指令
        bind(el, binding, vnode) { //点击div以外区域，隐藏div
            function documentHandler(e) {
                if (el.contains(e.target)) {// 这里判断点击的元素是否是本身，是本身，则返回
                    return false;
                }
                if (binding.expression) {// 判断指令中是否绑定了函数
                    binding.value(e);// 如果绑定了函数 则调用那个函数，此处binding.value就是handleClose方法
                }
            }
            el.__vueClickOutside__ = documentHandler;// 给当前元素绑定个私有变量，方便在unbind中可以解除事件监听
            document.addEventListener('click', documentHandler);
        },
        update() {},
        unbind(el, binding) {// 解除事件监听
            document.removeEventListener('click', el.__vueClickOutside__);
            delete el.__vueClickOutside__;
        },
    })
};
